﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Ingreso al sistema ENT-Project Management</title>
</head>
<body style="background-color: #782B1E">

    <form id="form1" runat="server">
    <ext:ScriptManager ID="ScriptManager1" runat="server" Theme="Gray">
    </ext:ScriptManager>
    
    <ext:Window ID="winLogin" runat="server" Height="140" ButtonAlign="Center" CenterOnLoad="true"
        Closable="false" Icon="Lock" Title="Ingrese sus datos" Width="300" BodyStyle="padding:10px;"
        Draggable="false">
        <Body>
            <ext:FormLayout ID="FormLayout1" runat="server" LabelWidth="80">
                <ext:Anchor Horizontal="100%">
                    <ext:TextField ID="txtUsername" SelectOnFocus="true" runat="server" ReadOnly="false"
                        FieldLabel="Username" AllowBlank="false" BlankText="El usuario es requerido."
                        Text="" EnableKeyEvents="true" />
                </ext:Anchor>
                <ext:Anchor Horizontal="100%">
                    <ext:TextField ID="txtPassword" runat="server" ReadOnly="false" InputType="Password" FieldLabel="Password" AllowBlank="false" BlankText="La clave es requerida." Text="" EnableKeyEvents="true">
                        <AjaxEvents>
                            <KeyPress OnEvent="Button1_Click"  Before="
                                    if(e.getKey()==Ext.EventObject.ENTER) 
                                    {
                                        e.preventDefault();
                                        return(true);
                                    }
                                    return(false);
                                "/>                           
                        </AjaxEvents>
                    </ext:TextField>
                </ext:Anchor>
            </ext:FormLayout>
            
        </Body>
        <Buttons>
            <ext:Button ID="btnIngresar" runat="server" Text="Ingresar" Icon="Accept">
                <AjaxEvents>
                    <Click OnEvent="Button1_Click">
                        <EventMask ShowMask="true" Msg="Verificando..." />
                    </Click>
                </AjaxEvents>
                <Listeners>
                    <Click Handler="
                            if(!#{txtPassword}.validate() || !#{txtUsername}.validate() ) 
                            {
                                Ext.Msg.alert('Error','El usuario y/o password son campos obligatorios');
                                return false; 
                            }" />
                </Listeners>
            </ext:Button>
        </Buttons>
        <Listeners>
            <Show Handler="#{btnIngresar}.focus();" />
        </Listeners>
    </ext:Window>
    
    </form>
</body>
</html>